home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / k9.arc / K9.DOC next >
Text File  |  1988-06-27  |  22KB  |  466 lines

  1. K9.DOC
  2. documentation for K9 version 8/20/86
  3. DPB
  4.  
  5. ///////////////////////////////////////////////////////////////////////////
  6. ///////////////////////////////////////////////////////////////////////////
  7.  
  8.  
  9. K9 is a multipurpose resident utility intended primarily to make life easier 
  10. for programmers.  It may be of some use to others as well, though user-
  11. friendliness has not been a design objective, especially in the documentation, 
  12. which assumes a considerable understanding of DOS.  K9 is named after Dr. 
  13. Who's equally loyal, equally mindless, and equally squirrelly assistant.  
  14.  
  15.  
  16. ///////////////////////////////////////////////////////////////////////////
  17.  
  18.  
  19. THIS SOFTWARE IS DISTRIBUTED UNDER THE SHAREWARE CONCEPT.  The usual shareware 
  20. "rules" apply.  Anyone making regular use of K9 is requested to send $25 to:
  21.  
  22.         David P. Babcock
  23.         110 West Grant, #27-D
  24.         Minneapolis  MN  55403
  25.  
  26. Contributors' comments and suggestions are welcome via CompuServe (73307,2441) 
  27. or by mail anytime. 
  28.  
  29.  
  30. ///////////////////////////////////////////////////////////////////////////
  31. ///////////////////////////////////////////////////////////////////////////
  32.  
  33. Users of the Leading Edge Model D must not use K9 without reading HOT KEYS 
  34. (below) carefully!!  This information may be of use to other clone owners 
  35. as well.
  36.  
  37.  
  38. ///////////////////////////////////////////////////////////////////////////
  39.  
  40. INVOCATION
  41. ----------
  42.  
  43. K9 is meant to be invoked at boot time from a batch file.  It's safest that 
  44. way because it will be below any transient programs.  K9 returns a DOS 
  45. errorlevel of 0 if it loads successfully, and 1 if it finds itself already 
  46. resident.  It occupies 16K. 
  47.  
  48. A click may be heard from the speaker when K9 loads.  This is from 
  49. initialization of K9's microsecond timer and is not cause for concern. 
  50.  
  51. K9 requires DOS v. 2.0 or later.  An attempt to load it under an earlier 
  52. version of DOS will return an error message and a DOS errorlevel of 255.
  53.  
  54.  
  55. AUTOMATIC FUNCTIONS 
  56. ------------------- 
  57.  
  58. The DOS keyboard buffer is expanded from 15 to 142 characters.  
  59.  
  60. The screen is turned off after 30 minutes of keyboard inactivity.  The cursor 
  61. may or may not remain visible.  Any keystroke restores the screen.  This 
  62. function works on IBM machines or close compatibles and with most EGA cards. 
  63.  
  64. The DOS editor functions are extended to include F7 and F8 as recalling 
  65. previous command lines.  The most recent 256 bytes are maintained in a 
  66. circular buffer that may be traversed backward via F7 or forward via F8.  The 
  67. least recent command line in the buffer may be missing one or more leading 
  68. characters.  The command is displayed as though the user had typed Escape, 
  69. clearing the command line, and then the entry, but has not typed Enter.  The 
  70. DOS editor keys F1-F6 work as usual.  
  71.  
  72. The F7 and F8 keys can be extended to work within programs by setting the "W" 
  73. switch to a non-zero value.  This applies only to text entered via the DOS 
  74. buffered input function, as in DEBUG, SYMDEB, or EDLIN.  This input is 
  75. maintained in a separate buffer, so that command lines will be recalled at the 
  76. command prompt and text previously entered during the current execution of the 
  77. program will be recalled while in the program.  The program text buffer is 
  78. cleared each time a program is loaded, and an attempt to use F7 or F8 if the 
  79. buffer is empty will cause the function key to revert temporarily to its non-
  80. K9 definition.  Thus, programs that define F7 and F8 for their own use can run 
  81. without interference from K9, even with the "W" switch set, as long as they 
  82. have not used the DOS buffered input function. 
  83.  
  84. A microsecond-resolution timer is started any time INT 21H is executed with 
  85. AH=0FFh, and stopped when INT 21H is executed with AH=0FEh.  The elapsed time 
  86. in microseconds modulo 54925 (one timer tick) is displayed on the screen.  The 
  87. interrupt service routine preserves all registers and flags.  Assuming the 
  88. code to stop the timer is 
  89.         
  90.         mov     ah,0FEh
  91.         int     21h
  92.  
  93. the timing is from the first instruction after the first INT to but not 
  94. including the "mov" instruction.  The timer will be inaccurate if invoked 
  95. while the speaker is operating.  If it is suspected that the microsecond 
  96. counter is overflowing, this can be tested by noting whether repeated 
  97. invocations show instances of significantly longer elapsed times (indicating 
  98. one or more timer tick interrupts from the hardware) in accordance with 
  99. probability.  
  100.  
  101.  
  102. COMMAND LINE PARAMETERS
  103. -----------------------
  104.                                                       
  105. On loading, K9 will scan the command line tail for parameters.  A parameter is 
  106. any alphabetic character, with lower case mapping to upper case.  The 
  107. corresponding switch is set based on the character following the alphabetic 
  108. character, as follows.  All switches are defined in such a way that the 
  109. machine behaves as much like a non-K9'd machine as possible if K9 is invoked 
  110. with no command tail.  
  111.  
  112.         following character             parameter value
  113.         -------------------             ---------------
  114.                 -                       0
  115.                 +                       1
  116.                 0..9                    0..9
  117.                 other                   1
  118.  
  119. Any missing switch is set to 0.
  120.  
  121. The following switches are defined:
  122.  
  123.         switch  definition
  124.         ------  ----------
  125.  
  126.         A       only [A]lt key sequences are hot.  (See HOT KEYS below.)
  127.  
  128.         B       A [B]/W monitor is being used with a color card.
  129.                 0 = NO (DEFAULT)
  130.                 other = YES.
  131.  
  132.         C       display time of day in upper right corner of
  133.                 screen.
  134.                 0 = OFF (DEFAULT).
  135.                 1 = display only at command prompt.
  136.                 2 = display all the time.
  137.  
  138.         D       implement [D]vorak keyboard.
  139.                 0 = Qwerty (DEFAULT), any other=Dvorak.
  140.  
  141.         E       pause the system and notify the user if a DOS [e]rrorlevel of
  142.                 at least the switch value is being returned by a non-resident 
  143.                 process to its parent.  (0 = OFF [default].)
  144.  
  145.         F       see "K" switch.
  146.  
  147.         H       park hard disk [H]eads at every command prompt.
  148.                 0 = no (DEFAULT).
  149.                 1 = yes.
  150.  
  151.         I       On Alt-13, check to see if the interrupt vector table contains
  152.                 any addresses higher than K9 but below 0C8000h, and refuse to 
  153.                 remove K9 if any such are found unless the segments are 
  154.                 identical to what they were when K9 was loaded.  
  155.  
  156.                 0 = yes (DEFAULT).  This option makes it very unlikely that
  157.                   K9 will let itself be removed unless it is the highest item 
  158.                   in memory, thus avoiding fatal corruption of the memory
  159.                   allocation chain.
  160.                 1 = no.  This allows for situations where orphan vectors may
  161.                   be in the table.  With this option, the user must be much 
  162.                   more careful not to try to remove K9 if there are any 
  163.                   resident utilities above it, since the only check will be 
  164.                   that there is no program running. 
  165.  
  166.         K       If non-zero, any K9 function request must be preceded by 
  167.                 pressing a specific control [K]ey and function key 
  168.                 simultaneously.  The required control key is based on the K 
  169.                 switch: 
  170.                 
  171.                 1 = right Shift key
  172.                 2 = left Shift key
  173.                 4 = Ctrl key
  174.                 8 = Alt key
  175.                 
  176.                 The [F]unction key is based on the value of the F switch.  If 
  177.                 F is zero, F10 is selected.  If F is any other value (X), then 
  178.                 FX is selected.
  179.  
  180.                 The F switch is meaningless if K is zero.
  181.  
  182.         L       select [L]ist device for Alt-7  (1=LPT1:, 2=LPT2:,
  183.                 3=LPT3:.  DEFAULT (0) = LPT1:.
  184.  
  185.         P       define Shift-[P]rtSc.
  186.                 0 = BIOS-defined function (DEFAULT).
  187.                 1 = save screen to disk.
  188.                 2 = Shift-PrtSc has no function.  
  189.  
  190.                 In mode 1, the contents of the screen are saved in a file in 
  191.                 the root directory of the current drive, whose name is the 
  192.                 number of timer ticks since midnight in hex, with an extension 
  193.                 of .SCR.  Carriage return-line feed sequences are inserted, 
  194.                 and any character less than 20h or greater than 7Fh is 
  195.                 replaced with a space, so that the resulting file will dump to 
  196.                 a printer without external processing.  The file-naming method 
  197.                 allows successive screen saves with the assurance that an 
  198.                 ASCII sort by name of files generated during a calendar day 
  199.                 will produce a chronological ordering.
  200.  
  201.                 When the screen is saved, the name of the save file is written 
  202.                 at the top of the screen.  (The name of the most recent file 
  203.                 name may be recovered by Alt-6/Ctrl-F (see below).)  K9's 
  204.                 usual procedure of restoring the screen that existed before 
  205.                 its write operation on the next keypress operates here, too; 
  206.                 but in this case the result can be startling if there was much 
  207.                 screen activity since the screen save request was made.  For 
  208.                 eaxmple: you enter DIR for a lengthy directory, and in the 
  209.                 middle of it request a screen save.  This request is served, 
  210.                 the save file name is flashed at the top of the screen 
  211.                 (uselessly in this case), and the directory resumes, returning 
  212.                 eventually to the command prompt.  Your first keystroke here 
  213.                 will recall the screen that was up when the save file message 
  214.                 was flashed.  Nothing is harmed, but the screen may look 
  215.                 funny.  (Of course Alt-8/Ctrl-H will clear it.)
  216.  
  217.         Q       set AT keyboard typematic delay to Q [q]uarter seconds, in 
  218.                 range 1-4.  DEFAULT=2 quarter seconds (same as AT's boot 
  219.                 value).  This does not work on some compatibles, including the 
  220.                 latest versions tested of the PC's Limited AT and the Sperry 
  221.                 IT (even with an IBM keyboard), though the Sperry was tested 
  222.                 only with the keyboard dipswitch in the "IT" position.  The 
  223.                 function is known to work on the IBM PC-AT, the Victor V286, 
  224.                 the Eclipse ECS, and the Amax AT-3000.  
  225.  
  226.         R       set AT keyboard typematic repetition [r]ate to value as 
  227.                 follows (DEFAULT=10.0 cps, same as AT's boot value): 
  228.  
  229.                 1 = 30.0 cps (fastest allowed by AT) 
  230.                 2 = 20.0 cps 
  231.                 3 = 15.0 cps 
  232.                 4 = 10.0 cps (standard AT rate) 
  233.                 5 =  8.0 cps 
  234.                 6 =  5.5 cps 
  235.                 7 =  4.0 cps 
  236.                 8 =  2.7 cps 
  237.                 9 =  2.0 cps (slowest allowed by AT) 
  238.  
  239.         S       (for internal use)
  240.  
  241.         W       Extend F7 and F8 to work [W]ithin programs.
  242.  
  243.  
  244. HOT KEYS
  245. --------
  246.  
  247. While resident, K9 is accessible to the user by the Alt key being held down 
  248. while a decimal number is entered THROUGH THE NUMERIC KEYPAD, or, if the 'A' 
  249. switch is zero, alternatively by Ctrl and a letter key.  The latter 
  250. possibility is offered only because some clones, notably Leading Edge, don't 
  251. buy K9's method of distinguishing Alt-keypad combinations from anything else 
  252. that generates the same ASCII value. 
  253.  
  254. If the "K" switch is non-zero, this request must be preceded by a control-key-
  255. plus-function-key combination (whose effect may be canceled by Alt-0).  See 
  256. the description of the "K" switch for a further description of this.  If the 
  257. "K" switch is non-zero and K9 is awaiting a request, the K9 logo will appear 
  258. in the upper right corner of the screen (overriding the clock if a clock 
  259. option is selected).  
  260.  
  261. If any K9 operation puts anything on the screen, the existing screen is first 
  262. saved.  It will be restored by the next keystroke other than the PrtSc key or 
  263. either Shift key.  If it is desired to restore the screen without having DOS 
  264. or the current program read a keystroke, the Alt key is handy.  
  265.  
  266.  
  267. Defined functions are as follows.  The second key combination listed is 
  268. allowed unless the 'A' switch is non-zero.
  269.  
  270.  
  271. ==============================================================================
  272.  
  273. Alt-1/Ctrl-A: Display system status, consisting of:
  274.  
  275. CPU (8086/88, 80186/188, 80286/88, or V20/V30)
  276. presence or absence of numeric coprocessor
  277. number of parallel ports
  278. number of serial ports
  279. equipment identification byte, per IBM definition
  280. total memory
  281. memory currently free
  282.   (This tells how much memory is available for allocation by DOS.  Note that 
  283.   this will always be 0 at the command prompt, since COMMAND.COM does not
  284.   free memory until it starts a new process.)
  285. ROM date
  286. numeric coprocessor registers and flags, if a numeric coprocessor was found
  287.   (The display is based on names given in the Intel manual and is 
  288.   straightforward.  The only item that may not be immediately obvious is 
  289.   "remainder."  This is the result of C0*4 + C3*2 + C1, which is the remainder 
  290.   left by an FPREM operation.  Exception flags and pointers are not 
  291.   displayed.) 
  292.  
  293. ==============================================================================
  294.  
  295. Alt-2/Ctrl-B: Invoke calculator.  This may also be used for number base 
  296. conversions.  
  297.  
  298. Alt-2 requires a numeric coprocessor, the author having written this function 
  299. mainly to get the hang of writing for the 8087 in the first place.  Arguments 
  300. are given in RPN format.  Operators are +, -, *, /, ** (power), SQR, SQRT, LN, 
  301. LOG2, LOG10, PE (E to power), P2 (2 to power), AIN (arithmetic inverse, or 
  302. unary minus), GIN (geometric inverse, or 1/x), SIN, COS, TAN, COT, SEC, CSC, 
  303. DEG (degrees to radians), RAD (radians to degrees), ASIN, ACOS, ATAN, ACOT, 
  304. and ! (factorial).  Operators may be entered in upper or lower case.  Operands 
  305. may be entered in base 2, 8, 10, or 16, or standard or scientific floating-
  306. point format.  Base identifiers (postfix) are: 2: 'B' or 'b'; 8: 'Q' or 'q'; 
  307. 10 (default): 'D' or 'd'; 16: 'H' or 'h' or 'X' or 'x.' A leading hex literal 
  308. is not allowed.  Alpha constants recognized are PI and E.  Arguments to trig 
  309. functions are in radians (values in degrees must be converted with the DEG 
  310. operator).  Inverse trig functions do not allow negative arguments (if one is 
  311. supplied, its absolute value is used), and results are in radians, which may 
  312. be converted to degrees with the RAD operator.  
  313.  
  314. Output is displayed below the parameter line in scientific notation floating 
  315. point with 15 digits of precision.  On the line below this, binary, octal, 
  316. decimal, and hexadecimal representations of the least significant 32 bits of 
  317. the whole portion of the result are displayed, truncated toward 0, with the 
  318. exception that if the result is outside the range -(2^63-1) .. 2^63-1, 0 is 
  319. displayed.  (0 may, of course, be a valid result--user examination is 
  320. required.)  
  321.  
  322. The calculator may be exited by pressing the Enter key when it is awaiting 
  323. input if nothing else has been entered.  
  324.  
  325. The truncation (rather than rounding) of the whole number portion can give the 
  326. appearance of a conflict between the floating point output and the whole 
  327. number output in certain calculations.  The following was taken from the 
  328. screen after an actual calculation: 
  329.  
  330. 30 deg sin sqr 30 deg cos sqr + 50000 * 
  331. +5.00000000000000e+004                                                          
  332. 1100001101001111b 141517q 49999d C34Fh
  333.  
  334. The trig identity is known to produce 1, which, multiplied by 50000, gives 
  335. 50000.  The floating point output does give this.  However, the whole number 
  336. is given as 49999.  This is because, cos(30) being irrational, the actual 
  337. calculation through the "+" may yield a result that is only approximately 1, 
  338. because of rounding errors.  In this case the identity yields a result that is 
  339. less than 1, but by so little that multiplying it by 50000 gives 50000 exact 
  340. to fifteen significant digits.  To people, this is 50000.  But to the numeric 
  341. coprocessor, it isn't, and when the coprocessor is told to truncate this 
  342. number, it does so.  
  343.  
  344. ==============================================================================
  345.  
  346. Alt-3/Ctrl-C: Display the ASCII character set.  Each character is displayed in 
  347. hexadecimal, decimal, and character representations.  
  348.  
  349. ==============================================================================
  350.  
  351. Alt-4/Ctrl-D: Display the state of all switches, and allow changes.  The 
  352. format for changes is the same as in the command tail at startup.  
  353.  
  354. ==============================================================================
  355.  
  356. Alt-5/Ctrl-E: Toggle between Qwerty and Dvorak keyboard modes.  (This may also 
  357. be done via the 'D' switch in Alt-4/Ctrl-D, but allowance is made for the fact 
  358. that the user who finds the wrong keyboard layout may not know where the 'D' 
  359. key is.) 
  360.  
  361. ==============================================================================
  362.  
  363. Alt-6/Ctrl-F: This copies the most recent file name generated by Shift_PrtSc 
  364. to the DOS keyboard buffer.  
  365.  
  366. ==============================================================================
  367.  
  368. Alt-7/Ctrl-G: Send commands to a printer using an extended Epson command set.  
  369. Not all commands are supported by all Epson or Epson-compatible printers.  The 
  370. following commands are implemented.  Those marked with an asterisk turn an 
  371. option on if entered in upper case, and off if entered in lower case.  The LPT 
  372. number may be selected via the L switch.        
  373.  
  374.           (A)ll [flush the printer buffer]
  375.         * (B)old
  376.         * (C)ondensed
  377.         * (D)ouble strike
  378.         * (E)lite [12 CPI instead of 10]                        
  379.           (F)orm feed
  380.         * (H)igh bit strip
  381.         * (I)talics
  382.         * (L)etter quality
  383.         * (M)ini [form length = 8 1/2" instead of 11"]
  384.           (N)ew [reset printer]
  385.         * (O)ut [enable paper out sensor]
  386.         * (P)roportional print   
  387.           (R)everse line feed
  388.         * (S)kip over perf 1"
  389.         * (T)wo [skip over perf 2"]
  390.         * (U)nderline
  391.         * (W)ide ["expanded"]                                    
  392.         * (Z)ero slash
  393.           (~) Carriage return                                                
  394.  
  395. ==============================================================================
  396.  
  397. Alt-8/Ctrl-H: Clear screen, do not home.
  398.  
  399. ==============================================================================
  400.  
  401. Alt-9/Ctrl-I: [Not used, to leave Alt-9 available to enter an ASCII Tab]
  402.  
  403. ==============================================================================
  404.  
  405. Alt-10/Ctrl-J: Terminate the current process and restore the interrupt vector 
  406. table.  This (usually) gets out of programs that are hung up in loops, or from 
  407. which the user wants to escape but doesn't know how.  It restores all 
  408. interrupt vectors to whatever they were after K9 finished loading.  Open file 
  409. handles are not closed unless the particular DOS version or implementation 
  410. takes care of it.  A DOS errorlevel of 0 is returned.
  411.  
  412. ==============================================================================
  413.  
  414. Alt-11/Ctrl-K: Park hard disk heads.  If this is attempted while not at the 
  415. command prompt, the heads are left alone and a message appears. 
  416.  
  417. ==============================================================================
  418.  
  419. Alt-12/Ctrl-L: [Not used, to leave Alt-12 available to enter an ASCII Form Feed]
  420.  
  421. ==============================================================================
  422.  
  423. Alt-13/Ctrl-M: Remove K9 from memory.  This request will be refused if a 
  424. program is running, or if the I switch is 0 and there are any interrupt 
  425. vectors pointing above K9 but below segment 0C800h that are different from 
  426. what they were when K9 was loaded.  (This is to try to avoid the corruption 
  427. that would occur if the user tried to remove K9 while memory was allocated 
  428. above it.)  Removal of K9 does not restore the AT keyboard typematic 
  429. parameters if those were changed. 
  430.  
  431. //////////////////////////////////////////////////////////////////////////
  432.                 
  433.  
  434. APPLICATION NOTES
  435. -----------------
  436.  
  437. One user reports that K9 and DOSEDIT make a nice combination.  DOSEDIT allows 
  438. inter-line editing while in DOS, avoiding the somewhat awkward (at least to 
  439. normal people) DOS editing keys.  It appears to be in the public domain.  
  440. Also, the original version of K9, circa July 1985, got along perfectly with 
  441. SuperKey.  K9 was then in C (it is now in assembler), but the logic of the 
  442. keyboard intercepts is the same, so maybe K9 and SuperKey still get along.  We 
  443. would like to hear from someone on that. 
  444.  
  445. If used along with SideKick, K9 should be loaded after SideKick.  This allows 
  446. the F7 and F8 keys to work properly within SideKick's calculator, for users 
  447. who prefer (or, for lack of a numeric coprocessor, must use) that calculator.
  448.  
  449. K9 gets along fine with CodeSmith-86 (which helped bring it to life in the 
  450. first place), SYMDEB, and DEBUG.  We would be interested to hear of 
  451. compatibility or lack thereof with other debuggers.  
  452.  
  453.  
  454. //////////////////////////////////////////////////////////////////////////
  455.  
  456.  
  457. TECHNICAL NOTES
  458. ---------------
  459.  
  460. Of possible interest in multiple screen environments, or for heaven knows what 
  461. other reasons: K9 uses BIOS to write to the screen, with the exception of the 
  462. clock and the ASCII table, which write directly to the video buffer.
  463.  
  464. K9 is written in assembler and assembled with Phoenix Technologies' LPASM, v. 
  465. 2.00.
  466.